package com.yupi.yuoj.model.dto.user;

import java.io.Serializable;
import java.util.regex.Pattern;

import lombok.Data;

import javax.servlet.http.HttpServletRequest;

/**
 * 用户创建请求
 *
 * @author <a href="https://github.com/liyupi">程序员鱼皮</a>
 * @from <a href="https://yupi.icu">编程导航知识星球</a>
 */
@Data
public class UserAddRequest implements Serializable {

    /**
     * 账号
     */
    private String userAccount;

    /**
     * 密码password
     */
    private String userPassWord;

    /**
     * 用户角色: user, admin
     */
    private String userRole;


    /**
     * 从 HttpServletRequest 中获取 userAccount、userPassWord 和 userRole 的值
     *
     * @param request HTTP 请求对象
     */
    public void fromRequest(HttpServletRequest request) {
        this.setUserAccount(request.getParameter("userAccount"));
        this.setUserPassWord(request.getParameter("userPassWord"));
        this.setUserRole(request.getParameter("userRole"));
    }

    /**
     * 用户头像
     */
//    private String userAvatar;


    /**
     * 用户昵称
     */
//    private String userName;

    private static final long serialVersionUID = 1L;
}